package com.gmh.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;


/*
* 配置swagger
*
* */

@Configuration
@EnableSwagger2WebMvc
public class Knife4jConfig {

    @Bean
    public Docket Api(){
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("校邻通")
                        .description("接口文档")
                        .termsOfServiceUrl("")
                        .contact(new Contact("gmh", "https://github.com/gmh-gmh", ""))
                        .license("Apache 2.0")
                        .version("1.0")
                        .build())
        .groupName("1.0")
        .select()
        .apis(RequestHandlerSelectors.basePackage("com.gmh.controller"))
        .paths(PathSelectors.any())
        .build();
        return docket;
    }
}
